package Chapter6.complete;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@Entity
public class PublisherComplete {
	private int id;
	private String name;
	private Set<BookComplete> books;
	private AddressComplete address;

	public PublisherComplete() {
	}

	public PublisherComplete(String name) {
		this.name = name;
	}

	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(mappedBy = "publisher")
	public Set<BookComplete> getBooks() {
		return books;
	}

	public void setBooks(Set<BookComplete> books) {
		this.books = books;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "address_id")
	public AddressComplete getAddress() {
		return address;
	}

	public void setAddress(AddressComplete address) {
		this.address = address;
	}

}
